<template>
<div class="vue-box sbot sbot-fluid">
  <!-- 参数栏 -->
  <div class="c-panel">
    <el-form :inline="true">
      <!-- 表单 -->
      <sa-item v-model="m.avatar" type="img" name="用户头像" br />
      <sa-item v-model="m.nickName" type="text" name="用户昵称" br />
      <sa-item v-model="m.name" type="text" name="用户账户" br />
      <sa-item v-model="m.phone" type="text" name="联系方式" br />
      <sa-item v-model="m.email" type="text" name="邮箱" br />

      <sa-item name="出生日期" br>
        <el-date-picker type="datetime"  value-format="yyyy-MM-dd  HH:mm:ss" v-model="m.birth" placeholder="请选择出生日期" clearable></el-date-picker>
      </sa-item>
      <sa-item v-model="m.height" type="text" name="身高(/cm)" br />
      <sa-item v-model="m.weight" type="text" name="体重(/kg)" br />
      <sa-item v-model="m.blood" type="enum" name="血型(xo)" jtype="3" :jv="dims.BLOOD_TYPE" br />
      <sa-item v-model="m.sex" type="enum" name="用户性别" jtype="3" :jv="dims.GENDER" br />
      <sa-item v-model="m.note" type="textarea" name="个人简介" br />
    </el-form>
  </div>
</div>
</template>

<script>
import sa from '@/sa-frame/sa';

export default {
  name: 'bus-user-add',
  props: {
    param: Object
  },
  data() {
    return {
      // 超级对象
      m: this.param,
      dims: {},
    }
  },
  created: function () {
    this.dims = sa.$sys.getCurd()
  },
  methods: {

    // 变更
    ok: function () {
      // 表单校验
      let m = this.m;
      sa.checkNull(m.nickName, '请输入用户昵称！');
      sa.checkNull(m.nickName, '请输入用户名！');
      sa.checkNull(m.phone, '请输入联系方式！');
      sa.checkNull(m.status, '请确认状态！');
      sa.check(m.phone.length > 11, '联系方式超出范围！');

      // 添加
      sa.ajax('/scs/user/update', m, function (res) {
        sa.alert(res.msg, function () {
          sa.f5()
        }.bind(this));
      }.bind(this));
    }
  }
}
</script>

<style scoped></style>
